package com.rules.admin.expression;


import com.rules.admin.entity.ParserContext;

public class ParserExpression implements Expression {
   Long ruleId;
   int deductionNo;
   String groupId;
   String artifactId;
   String testId;

   public ParserExpression(String groupId, String artifactId, Long ruleId, int deductionNo) {
      this.groupId = groupId;
      this.artifactId = artifactId;
      this.ruleId = ruleId;
      this.deductionNo = deductionNo;
   }

   public ParserExpression(ParserContext parserContext) {
      this.groupId = parserContext.getGroupId();
      this.artifactId = parserContext.getArtifactId();
      this.ruleId = parserContext.getRuleId();
      this.deductionNo = parserContext.getDeductionNo();
      this.testId = parserContext.getTestId();
   }

   public void accept(ExpressionVisitor visitor) {
   }

   public String toString() {
      StringBuilder sb = new StringBuilder();
      sb.append("Tools.save(\"").append(this.groupId).append("\",\"").append(this.artifactId).append("\",").append(this.ruleId).append(",\"").append(this.testId).append("\",").append(this.deductionNo).append(")");
      return sb.toString();
   }
}
